The present disclosure relates to a communication device, a communication method, and a computer-readable storage medium that stores a communication program that are used by a communication system that performs peer-to-peer (P2P) communication between a plurality of communication devices.
A technology is known that, in order for a plurality of communication devices to perform P2P communication, establishes a session between the communication devices. A Session Initiation Protocol (SIP) has been disclosed that is a connection protocol for establishing a session between the communication devices. Because a session can be established easily by following the SIP, the SIP is widely used.
Generally speaking, in the SIP, a session is established between the communication devices through a server that processes a SIP request. First, a communication device on a calling side (hereinafter called the calling device) transmits to the server a session start message (a call request, or INVITE) that includes offer information. The offer information includes information on a port that will be used for receiving media data, information on types of media that can be received (for example, codecs for audio and video), and the like. The server takes the session start message that has been received from the calling device and transmits (forwards) it to a partner communication device (hereinafter called the called device) with which the session will be established. The called device, upon receiving the session start message through the server, repeatedly transmits a provisional response message, 180 Ringing, through the server to the calling device, until a receiving permission command is input by a user. When the receiving permission command is input, the called device selects the media type that it will use from the offer information that is included in the session start message. The called device includes information on the selected media type as answer information in a response message, 200 OK, and transmits it to the server. The server takes the response message it has received from the called device and transmits (forwards) it to the calling device. Based on the answer information that is included in the received response message, the calling device then transmits data directly to the called device, without going through the server. This establishes the session between the calling device and the called device.